﻿/// <reference path="BasePopupControl.js" />


TA.Turbo.Controls.TurboProgress = function TurboProgress(clientId)
{
	this.BasePopupControl(clientId);
}
TA.Turbo.Controls.TurboProgress.Inherit(TA.Turbo.Controls.BasePopupControl);
var ____a;
if (____a)
{
	TA.Turbo.Controls.TurboProgress.prototype = new TA.Turbo.Controls.BasePopupControl();
	TA.Turbo.Controls.TurboProgress.prototype.BasePopupControl = new TA.Turbo.Controls.BasePopupControl();
}
var $TurboProgress = TA.Turbo.Controls.TurboProgress;
$PropertyDefinition.Define($TurboProgress, "DisplayTimeout", true, 0);

$TurboProgress.prototype._counter = 0;
$TurboProgress.prototype._timeoutId = null;

$TurboProgress.prototype.Start = function Start()
{
	if (this._counter == 0)
		this._timeoutId = setTimeout(this._DoShow.bind(this), this.get_DisplayTimeout());
	++this._counter;
}


$TurboProgress.prototype.Stop = function Stop()
{
	--this._counter;
	if (this._counter == 0)
	{
		if (this._timeoutId != null)
		{
			clearTimeout(this._timeoutId);
			this._timeoutId = null;
		}
		this._DoHide();
	}
}





$TurboProgress.prototype._DoShow = function _DoShow()
{
	this._timeoutId = null;
	this.set_Shown(true);
}
$TurboProgress.prototype._DoHide = function _DoHide()
{
	this.set_Shown(false);
}